using System;
using System.Collections.Generic;
using System.Text;
using NHibernate.Connection;
using NHibernate.Driver;
using NHibernate;
using System.Data;
using System.Collections;
using FutureOpen.Core.func.util;


namespace FutureOpen.Core.func.db
{
  
    public class DBUtil:MyDBEntity
    {
        //private static readonly string BATCH_SQL = "SELECT * from Art where art_index={1} limit 0,{0}";
        private static readonly string UPDATE_RECORD = "UPDATE art set art_index=1 where art_id={0}";

        public DBUtil()
        {
                        
        }

        public IDataReader ExecuteSQL(string sql)
        {
          
            NHibernate.SqlCommand.SqlString selectString = new NHibernate.SqlCommand.SqlString(sql);

            ISession session = base.factory.OpenSession();

                IDbCommand cmd = factory.ConnectionProvider.Driver.GenerateCommand(System.Data.CommandType.Text, selectString, new NHibernate.SqlTypes.SqlType[] { });
                cmd.Connection = session.Connection;
               IDataReader rs = cmd.ExecuteReader();
               
               return rs;
        }

        public void UpdateRecord(int id)
        {
            string sql = string.Format(UPDATE_RECORD, id);

            
        }

        

        
    }
}
